<template>
	<view>
		<detail-main :customer="customer"></detail-main>
	</view>
</template>

<script>
	import detailMain from "../../components/detail/detail-main.vue"
	export default {
		components:{
			detailMain
		},
		data() {
			return {
				customer: {
					cid: '',
					cname: '',
					csex: '',
					cphone: '',
					caddress: '',
					cage: '',
					cpic:'',
					man: false,
					woman: false,
					type:'编辑'  ,//编译客户信息
					
				}
			}
		},

		onLoad() {
			uni.$on('sendcustomerid', (data) => {
				uni.request({
					url: this.url + 'customer/getone',
					method: 'GET',
					data: {
						cid: data.cid
					},
					success: res => {
						this.customer.cid = res.data.data.c_id;
						this.customer.cname = res.data.data.c_name;
						this.customer.csex = res.data.data.c_sex;
						if (res.data.data.c_sex == 1) {
							this.customer.man = true;
							this.customer.woman = false;
						} else {
							this.customer.man = false;
							this.customer.woman = true;
						}

						this.customer.cphone = res.data.data.c_phone;
						this.customer.caddress = res.data.data.c_address;
						this.customer.cage = res.data.data.c_age;
						if(res.data.data.c_pic==''){this.customer.cpic='../../static/photo177.png'}
						else{this.customer.cpic= this.url +'upload/'+res.data.data.c_pic;}
					},
					fail: () => {},
					complete: () => {}
				});


			})
		},
		onUnload() {
			uni.$off('sendcustomerid');
		},
		methods: {}
	}
</script>

<style>
	
</style>
